﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CloudMusic.UC
{
    /// <summary>
    /// UCStoreWin.xaml 的交互逻辑
    /// </summary>
    public partial class UCStoreWin
    {
        public UCStoreWin()
        {
            InitializeComponent();

        }
        public static event EventHandler UCStoreClose;

        /// <summary>
        /// 打开窗体
        /// </summary>
        /// <param name="owner"></param>
        public static void ShowWin(Window owner)
        {
            //蒙板
            Grid layer = new Grid() { Background = new SolidColorBrush(Colors.White), Opacity = 0 };
            //父级窗体原来的内容
            UIElement original = owner.Content as UIElement;
            owner.Content = null;
            //容器Grid
            Grid container = new Grid();
            container.Children.Add(original);//放入原来的内容
            container.Children.Add(layer);//在上面放一层蒙板
            //将装有原来内容和蒙板的容器赋给父级窗体
            owner.Content = container;
            UCStoreWin ca = new UCStoreWin() { Owner = owner };
            ca.Show();
        }
        /// <summary>
        /// 关闭窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void closeStorePanel_Click(object sender, RoutedEventArgs e)
        {
            var owner = Application.Current.MainWindow;
            Close();
            //容器Grid
            Grid grid = owner.Content as Grid;
            //父级窗体原来的内容
            UIElement original = VisualTreeHelper.GetChild(grid, 0) as UIElement;
            //将父级窗体原来的内容在容器Grid中移除

            grid.Children.Remove(original);
            //赋给父级窗体
            owner.Content = original;
        }

        private void DMSkinSimpleWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // 设置全屏
          
        }
    }
}
